package com.shujia.junit;

import org.junit.Before;
import org.junit.Test;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class Demo2Student {
    private ArrayList<String> students;

    @Before
    public void init() {
        students = new ArrayList<String>();
        try {
            BufferedReader bufferedReader = new BufferedReader(new FileReader("data/students.txt"));
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                students.add(line);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @Test
    public void test() {
        for (String student : students) {
            System.out.println(student);
        }
    }

}
